/*
 * test_guild.cpp
 *
 *  Created on: Jul 30, 2014
 *      Author: killerg
 */


bool test_guild() {
/*
	// create guildmgr
	guildmgr_t* guildmgr = new guildmgr_t;

	// create guild
	{
		int playerid = 0;
		const char* name = "guild1";
		const char* intro = "this is my guild";

		assert(guildmgr->name2id.count(name) == 0);

		guild_t* guild = new guild_t;
		guild->id = guildmgr->guildid;
		guild->name = name;
		guild->intro = intro;

		guildmgr->name2id[name] = guild->id;
		guildmgr->guilds[guild->id] = guild;

	}

	// add player
	{
		int guildid = 0;
		int playerid = 1;
		int pos = 0;

		auto gitr = guildmgr->guilds.find(guildid);
		assert(gitr != guildmgr->guilds.end());

		auto guild = gitr->second;
		bool found = false;
		for (auto member : guild->members) {
			if (playerid == member->playerid) {
				found = true;
				break;
			}
		}
		assert(!found);

		auto member = new member_t;
		member->playerid = playerid;
		member->pos = pos;
		member->contribute = 0;

		guild->add(member);
	}

	// switch pos
	{
		int guildid = 0;
		int playerid = 0;
		int heresid = 1;

		auto gitr = guildmgr->guilds.find(guildid);
		assert(gitr != guildmgr->guilds.end());

		auto guild = gitr->second;
		member_t* leader = guild->find(playerid);
		member_t* heres = guild->find(heresid);

		assert(leader->pos == EGP_Head);
		assert(heres->pos != EGP_Normal);
	}

	// del player
	{
		int guildid = 0;
		int playerid = 1;

		auto gitr = guildmgr->guilds.find(guildid);
		assert(gitr != guildmgr->guilds.end());

		auto guild = gitr->second;
		member_t* todel = guild->find(playerid);
		guild->erase(todel);
		delete todel;
	}

	// delete guild
	{
		int guildid = 0;

		auto gitr = guildmgr->guilds.find(guildid);
		assert(gitr != guildmgr->guilds.end());

		guildmgr->name2id.erase(gitr->second->name);
		delete gitr->second;
		guildmgr->guilds.erase(gitr);
	}

	// delete guildmgr
	delete guildmgr;
*/
	return true;
}
